package com.rtzh.learnkotlin.ui

import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.rtzh.learnkotlin.R
import kotlinx.android.synthetic.main.activity_login.*

/**
 * 登录界面
 */
class LoginActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        login.setOnClickListener {
            val account = accountEdit.text.toString();
            val password = passwordEdit.text.toString();
            if (account == "admin" && password == "123456") {
                val intent = Intent(this, BroadCastActivity::class.java)
                startActivity(intent)
                finish()

            }else{
                Toast.makeText(this,"account or password is invalid",
                    Toast.LENGTH_SHORT).show()
            }
        }
    }
}